#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
constexpr ll inf = numeric_limits < ll >::max() >> 1;
int n, m, a, b, u, v, o, sz, t[150009]; ll d[150009], dd[150009]; bool used[150009];
vector < int > g[150009], gg[2][150009]; queue < int > q[2];
int main()
{
	freopen("edge.in", "r", stdin), freopen("edge.out", "w", stdout);
	cin.tie(nullptr) -> sync_with_stdio(false);
	cin >> n >> m >> a >> b, b = min(b, a + a), fill(d + 2, d + n + 1, inf), q[0].push(1);
	For(i, 1, m) cin >> u >> v, g[u].push_back(v), g[v].push_back(u);
	For(i, 1, n) gg[0][i] = gg[1][i] = g[i];
	while ( q[0].size() || q[1].size() )
	{
		o = q[0].empty() || ( q[1].size() && d[q[1].front()] < d[q[0].front()] ), u = q[o].front(), q[o].pop();
		if ( used[u] ) continue; used[u] = true;
		for ( int i : g[u] )
		{
			t[i] = u << 1 | o;
			if ( !o && d[i] > d[u] + a ) d[i] = d[u] + a, q[1].push(i);
		}
		for ( int i : g[u] )
		{
			for ( int j : gg[o][i] ) if ( d[j] > d[u] + b )
				if ( t[j] == u << 1 | o ) gg[o][i][sz++] = j; else d[j] = d[u] + b, q[o].push(j);
			gg[o][i].resize(sz), sz = 0;
		}
	}
	For(i, 2, n) cout << d[i] << '\n';
	return 0;
}